load("//tools/lint:linters.bzl", "clang_tidy_test")

package(
    default_visibility = ["//:android_cuttlefish"],
)

cc_library(
    name = "config_path",
    srcs = ["config_path.cpp"],
    hdrs = ["config_path.h"],
    deps = [
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/common/libs/utils:result",
        "//libbase",
    ],
)

clang_tidy_test(
    name = "config_path_clang_tidy",
    srcs = [":config_path"],
    tags = [
        "clang-tidy",
        "clang_tidy",
    ],
)

proto_library(
    name = "cvd_persistent_data_proto",
    srcs = ["cvd_persistent_data.proto"],
)

cc_proto_library(
    name = "cvd_persistent_data",
    deps = [":cvd_persistent_data_proto"],
)

cc_library(
    name = "data_viewer",
    srcs = ["data_viewer.cpp"],
    hdrs = ["data_viewer.h"],
    deps = [
        "//cuttlefish/host/commands/cvd/instances:cvd_persistent_data",
        "//cuttlefish/common/libs/fs",
        "//cuttlefish/common/libs/utils:result",
        "//cuttlefish/common/libs/utils:signals",
    ],
)

clang_tidy_test(
    name = "data_viewer_clang_tidy",
    srcs = [":data_viewer"],
    tags = ["clang_tidy", "clang-tidy"],
)

cc_library(
    name = "device_name",
    srcs = ["device_name.cpp"],
    hdrs = ["device_name.h"],
    deps = [
        "//cuttlefish/common/libs/utils:result",
        "//libbase",
    ],
)

clang_tidy_test(
    name = "device_name_clang_tidy",
    srcs = [":device_name"],
    tags = [
        "clang-tidy",
        "clang_tidy",
    ],
)

cc_library(
    name = "instances",
    srcs = [
        "instance_database.cpp",
        "instance_database_types.cpp",
        "instance_group_record.cpp",
        "instance_manager.cpp",
        "instance_record.cpp",
        "operator_client.cpp",
        "status_fetcher.cpp",
    ],
    hdrs = [
        "instance_database.h",
        "instance_database_types.h",
        "instance_group_record.h",
        "instance_manager.h",
        "instance_record.h",
        "operator_client.h",
        "status_fetcher.h",
    ],
    deps = [
        ":cvd_persistent_data",
        "//cuttlefish/common/libs/fs",
        "//cuttlefish/common/libs/utils:contains",
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/common/libs/utils:json",
        "//cuttlefish/common/libs/utils:proc_file_utils",
        "//cuttlefish/common/libs/utils:result",
        "//cuttlefish/common/libs/utils:signals",
        "//cuttlefish/common/libs/utils:subprocess",
        "//cuttlefish/common/libs/utils:users",
        "//cuttlefish/host/commands/cvd/cli:command_request",
        "//cuttlefish/host/commands/cvd/cli:types",
        "//cuttlefish/host/commands/cvd/cli:utils",
        "//cuttlefish/host/commands/cvd/cli/commands:host_tool_target",
        "//cuttlefish/host/commands/cvd/cli/selector:parser",
        "//cuttlefish/host/commands/cvd/instances/lock",
        "//cuttlefish/host/commands/cvd/instances:config_path",
        "//cuttlefish/host/commands/cvd/instances:data_viewer",
        "//cuttlefish/host/commands/cvd/instances:device_name",
        "//cuttlefish/host/commands/cvd/instances:run_cvd_proc_collector",
        "//cuttlefish/host/commands/cvd/legacy:cvd_server_cc_proto",
        "//cuttlefish/host/commands/cvd/utils",
        "//cuttlefish/host/libs/command_util",
        "//cuttlefish/host/libs/config:config_constants",
        "//cuttlefish/host/libs/config:config_utils",
        "//cuttlefish/host/libs/config:cuttlefish_config",
        "//libbase",
        "@fmt",
        "@jsoncpp",
    ],
)

clang_tidy_test(
    name = "instances_clang_tidy",
    srcs = [":instances"],
    tags = [
        "clang-tidy",
        "clang_tidy",
    ],
)

cc_library(
    name = "reset_client_utils",
    srcs = ["reset_client_utils.cpp"],
    hdrs = ["reset_client_utils.h"],
    deps = [
        "//cuttlefish/common/libs/utils:contains",
        "//cuttlefish/common/libs/utils:environment",
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/common/libs/utils:proc_file_utils",
        "//cuttlefish/common/libs/utils:result",
        "//cuttlefish/common/libs/utils:subprocess",
        "//cuttlefish/host/commands/cvd/legacy",
        "//cuttlefish/host/commands/cvd/instances",
        "//cuttlefish/host/commands/cvd/instances:run_cvd_proc_collector",
        "//cuttlefish/host/commands/cvd/utils",
        "//libbase",
        "@fmt",
    ],
)

clang_tidy_test(
    name = "reset_client_utils_clang_tidy",
    srcs = [":reset_client_utils"],
    tags = [
        "clang-tidy",
        "clang_tidy",
    ],
)

cc_library(
    name = "run_cvd_proc_collector",
    srcs = ["run_cvd_proc_collector.cpp"],
    hdrs = ["run_cvd_proc_collector.h"],
    deps = [
        "//cuttlefish/common/libs/utils:contains",
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/common/libs/utils:proc_file_utils",
        "//cuttlefish/common/libs/utils:result",
        "//cuttlefish/host/commands/cvd/cli:types",
        "//cuttlefish/host/commands/cvd/utils:common",
        "//cuttlefish/host/libs/config:config_constants",
        "//libbase",
    ],
)

clang_tidy_test(
    name = "run_cvd_proc_collector_clang_tidy",
    srcs = [":run_cvd_proc_collector"],
    tags = ["clang_tidy", "clang-tidy"],
)
